﻿<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of sampleclass
 *
 * @author at8eqeq3
 */
class w_user extends widget {
    public $isWidget = true;
    public $header;

    public function __construct(){
        if(@isset($_SESSION['userid'])){
            $this->header = "Профиль";
        }else{
            $this->header = "Вход";
        }
    }

    public function widget_print(){
        if(@isset($_SESSION['user_id'])){
            global $cur_user;
            echo '<pre>';
            print_r($cur_user);
            echo '</pre>';
            echo "already entered as ".$cur_user->fields['login']."\n";
            echo "<a href=\"/backend/logout.php\">logout</a>\n";
        }else{
            /*if(isset($_SESSION['errmsg']['login'])){
                echo "<div id=\"error\">".$_SESSION['errmsg']['login'].' ('.$_SESSION['login_tryes'].")</div>\n";
                unset($_SESSION['errmsg']['login']);
            }*/
            $l_login = new field_text('l_login', 'Логин', true, '', 16, 16);
            $l_pass = new field_password('l_pass', 'Пароль', true, '', 16, 16);
            $fields = array($l_login, $l_pass);
            $f_enter = new form($fields, 'login', 'login', '', 'Войти');
            $f_enter->print_form2();
            echo "<a href=\"passremind\">Напомнить пароль</a><br />\n";
            echo "<a href=\"register\">Зарегистрироваться</a><br />\n";
            //echo "<img src=\"/do.captcha\" />".$_SESSION['cc']."<br />\n";
        }
    }
    
}
?>
